﻿@model ArticleModel
@using CAF.WebSite.Application.WebUI;
@using CAF.Infrastructure.Core.Domain.Cms.Articles;
@if (Model.ShowInventory)
{
<script>
    $(function () {

        $('input[id="@Html.FieldIdFor(model => model.DisplayStockAvailability)').on("change", toggleManageStock);

        function toggleManageStock() {
            if ($('#@Html.FieldIdFor(model => model.DisplayStockAvailability)').is(':checked')) {
                $('#pnlDisplayStockQuantity').show();
            }
            else {
                $('#pnlDisplayStockQuantity').hide();
            }
        }

    });
</script>
<div class="form-body">
    <div class="form-group">
        <label class="control-label col-md-2">
            @Html.LangLabelFor(model => model.StockQuantity)
        </label>
        <div class="col-md-3">
            @Html.EditorFor(model => model.StockQuantity)
            @Html.ValidationMessageFor(model => model.StockQuantity)
        </div>
    </div>

    <div id="pnlDisplayStockAvailability" class="form-group">
        <label class="control-label col-md-2">
            @Html.LangLabelFor(model => model.DisplayStockAvailability)
        </label>
        <div class="col-md-3">
            @Html.EditorFor(model => model.DisplayStockAvailability, new { @default = true })
            @Html.ValidationMessageFor(model => model.DisplayStockAvailability)
        </div>
    </div>

    <div id="pnlDisplayStockQuantity" class="form-group">
        <label class="control-label col-md-2">
            @Html.LangLabelFor(model => model.DisplayStockQuantity)
        </label>
        <div class="col-md-3">
            @Html.EditorFor(model => model.DisplayStockQuantity, new { @default = true })
            @Html.ValidationMessageFor(model => model.DisplayStockQuantity)
        </div>
    </div>
    <div id="pnlMinStockQuantity" class="form-group">
        <label class="control-label col-md-2">

            @Html.LangLabelFor(model => model.MinStockQuantity)
        </label>
        <div class="col-md-3">
            @Html.EditorFor(model => model.MinStockQuantity)
            @Html.ValidationMessageFor(model => model.MinStockQuantity)
        </div>
    </div>
    <div id="pnlLowStockActivity" class="form-group">
        <label class="control-label col-md-2">

            @Html.LangLabelFor(model => model.LowStockActivityId)
        </label>
        <div class="col-md-3">
            @Html.DropDownListFor(model => model.LowStockActivityId, ((LowStockActivity)Model.LowStockActivityId).ToSelectList(), new { @class = "form-control" })
            @Html.ValidationMessageFor(model => model.LowStockActivityId)
        </div>
    </div>
    <div id="pnlNotifyForQuantityBelow" class="form-group">
        <label class="control-label col-md-2">

            @Html.LangLabelFor(model => model.NotifyAdminForQuantityBelow)
        </label>
        <div class="col-md-3">
            @Html.EditorFor(model => model.NotifyAdminForQuantityBelow)
            @Html.ValidationMessageFor(model => model.NotifyAdminForQuantityBelow)
        </div>
    </div>

    <div id="pnlAllowBackInStockSubscriptions" class="form-group">
        <label class="control-label col-md-2">

            @Html.LangLabelFor(model => model.DeliveryTimeId)
        </label>
        <div class="col-md-3">
            @Html.DropDownListFor(model => model.DeliveryTimeId, Model.AvailableDeliveryTimes, T("Common.Unspecified"), new { @class = "form-control" })
            @Html.ValidationMessageFor(model => model.DeliveryTimeId)
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">

            @Html.LangLabelFor(model => model.IsFreeShipping)
        </label>
        <div class="col-md-3">
            @Html.EditorFor(model => model.IsFreeShipping)
            @Html.ValidationMessageFor(model => model.IsFreeShipping)
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">

            @Html.LangLabelFor(model => model.OrderMinimumQuantity)
        </label>
        <div class="col-md-3">
            @Html.EditorFor(model => model.OrderMinimumQuantity)
            @Html.ValidationMessageFor(model => model.OrderMinimumQuantity)
        </div>
    </div>
   
    <div class="form-group">
        <label class="control-label col-md-2">
            @Html.LangLabelFor(model => model.OrderMaximumQuantity)
        </label>
        <div class="col-md-3">
            @Html.EditorFor(model => model.OrderMaximumQuantity)
            @Html.ValidationMessageFor(model => model.OrderMaximumQuantity)
        </div>
    </div>
</div>
}
